﻿using System;
using System.Collections.Generic;

namespace NeedsMoreNinja.EventManager
{
    static class CEventManager<TEvent> where TEvent : IEvent
    {
        private static List<IEventListener<TEvent>> m_eventListeners = new List<IEventListener<TEvent>>( );

        public static void AddListener(IEventListener<TEvent> newListener)
        {
            m_eventListeners.Add(newListener);
        }

        public static void PostEvent(TEvent e)
        {
            foreach (IEventListener<TEvent> listener in m_eventListeners)
            {
                listener.Handle(e);
            }
        }
    }
}
